package org.example.controller;

import org.example.evaluate.engine.EvaluatePhone;
import org.example.vo.EvaluateInfo;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@RequestMapping("/evaluate")
@CrossOrigin("*")
public class EvaluateController {

    /*
     * {"version": 1, "guaranteePeriod": 2, "model: 3, "appearance": 4, "startingUp": 4}
     * @return
     */
    @PostMapping
    public Result evaluate(@RequestBody EvaluateInfo evaluateInfo, Integer phoneId) {
        EvaluatePhone evaluatePhone = new EvaluatePhone();
        evaluatePhone.init(evaluateInfo, BigDecimal.valueOf(3000));
        return Result.buildSuccess(evaluatePhone.begin());
    }
}
